package com.example.demo;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonAlias;

import java.util.Iterator;
import java.util.List;
import java.util.Map;

public class User {
    private String name;
    private String address;
    private String sex;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public static void main(String[] args) {
        String object="{\n" +
                "  \"result\": 22,\n" +
                "  \"data\": {\n" +
                "    \"data\": [{\n" +
                "      \"TaskParam\": [{\n" +
                "        \"BlankCell\": {\n" +
                "          \"name\": \"征收方式\",\n" +
                "          \"value\": \"{\\\"tzzxx\\\":[{\\\"fpbl\\\":\\\"0.0000%\\\",\\\"name\\\":\\\"王国宝\\\",\\\"zjhm\\\":\\\"340302196502090224\\\",\\\"zjlx\\\":\\\"居民身份证\\\"},{\\\"fpbl\\\":\\\"0.0000%\\\",\\\"name\\\":\\\"朱亚男\\\",\\\"zjhm\\\":\\\"340303198809051022\\\",\\\"zjlx\\\":\\\"居民身份证\\\"}],\\\"zsfs\\\":\\\"核定征收\\\"}\"\n" +
                "        }\n" +
                "      }],\n" +
                "      \"TaskResult\": [{\n" +
                "        \"ResultDesc\": \"\",\n" +
                "        \"ResultCode\": \"\"\n" +
                "      }],\n" +
                "      \"id\": \"grsds_scjy_brief_cj\"\n" +
                "    }]\n" +
                "  },\n" +
                "  \"qyid\": 11111,\n" +
                "  \"kjnd\": 2020,\n" +
                "  \"subType\": 2,\n" +
                "  \"kjqj\": 12,\n" +
                "  \"region\": \"12\",\n" +
                "  \"type\": \"28\",\n" +
                "  \"taskId\": 22222,\n" +
                "  \"taskStatus\": \"200C000000\",\n" +
                "  \"desc\": \"成功\"\n" +
                "}\n";
        String s = JSON.toJSONString(object);
        Map<String,Object> map = JSON.parseObject(object, Map.class);
        Map<String,Object> data = JSON.parseObject(String.valueOf( map.get("data")), Map.class);
        List<Map<String,Object>> data1 = JSON.parseObject(String.valueOf(data.get("data")), List.class);
        for (Map<String,Object> map1:data1){
            List<Map<String,Object>> data2=JSON.parseObject(String.valueOf(map1.get("TaskParam")), List.class);
            for (Map<String,Object> map2 :data2){
               Map<String,Object> data3=JSON.parseObject(String.valueOf(map2.get("BlankCell")), Map.class);
                Object name = data3.get("name");
                System.out.println(name);
            }
        }
//        JSONArray data1 = (JSONArray) data.get("data");
//        data1.stream().forEach(jsonObject->{
//            JSONObject jsonObject1 = (JSONObject) jsonObject;
//            JSONArray taskParams = JSON.parseArray((String) jsonObject1.get("TaskParam"));
//            taskParams.stream().forEach(taskParam->{
//                JSONObject taskParamNode1 = (JSONObject) jsonObject;
//            });
//
//
//        });

        System.out.println("1");
    }
}
